<template>
	<div class="active">
		<div class="fixed">
			<div class="title flex">
				<div class="title_left">
					<img @click="back" src="../assets/image/return.png"/>
				</div>
				<div class="add">
					填写商户信息
				</div>
				<div>
				</div>
			</div>

		</div>
		<div class="lists">
             <div class="inp">
			  	<p>商户名称(必填)</p>
			  	<input type="text" v-model="shop_name" placeholder="请输入内容"/>
			  </div>
			   
			   <div class="inp">
			  	<p>社会统一信用编码(必填)</p>
			  	<input type="text" v-model="ty_code" placeholder="请输入内容"/>
			  </div>
			  <div class="inp">
			  	<p>法人名称(必填)</p>
			  	<input type="text" v-model="fr_name" placeholder="请输入内容"/>
			  </div>
			  <div class="inp">
			  	<p>邀请码</p>
			  	<input type="text"  v-model="yq_code" placeholder="请输入内容"/>
			  </div>
			  
			  <div class="btns" @click="skipto_edit">
			  	下一步
			  </div>
             
			</div>
		</div>

	</div>

</template>

<script>
	export default {
		data() {
			return {
				shop_name:'',
				ty_code:"",
				fr_name:"",
				yq_code:""
			}
		},
		//在模板渲染成html前调用，即通常初始化某些属性值，然后再渲染成视图
		created: function() {

		},
		methods: {
			back() {
				this.$router.go(-1)
			},
		
			skipto_edit() {
				var that=this;
				
				
				if(that.shop_name) {} else {
				 this.$message.error('商户名称不能为空');
				return;
			}
				var str = /^[^_IOZSVa-z\W]{2}\d{6}[^_IOZSVa-z\W]{10}$/g
				if(str.test(that.ty_code)) {} else {
				 this.$message.error('请填写正确社会统一信用编码格式');
				return;
			}
				
				
				if(that.fr_name) {} else {
				 this.$message.error('法人名称不能为空');
				return;
			}
				var qs = require('qs');
			that.$http.post(this.baseURL+"/index.php/waveguest/login/add_store_data", qs.stringify({
						"store_mobile": localStorage.getItem("phone"),
						"store_id":localStorage.getItem("store_id"),
						"store_name":that.shop_name,
						  "store_credit":that.ty_code,
						  "store_person_name":that.fr_name,
						  "store_invited_code":that.yq_code,
					})).then(response => {
						console.log(response)
						if(response.data.status=="200"){
							this.$router.push({
					path: '/edit'
				});
						}else{
							 this.$message.error(response.data.message);
						}
                    
						
					})
					.catch(error => {

					});
				
				
				
			},
			
			
		},
		mounted() {

		},
	}
</script>

<style>

</style>
<style scoped="scoped">
	.active {
		
		background: white;
		width: 100%;
		max-width: 640px;
		height: 100%;
	}
	.title_left {
		width: 0.67391rem;
		height: 0.67391rem;
	}
	
	.lists {
		padding: 0 2rem ;

	}
.title_left>img {
		width: 0.67391rem;
		height: 0.67391rem;
	}
	
	.title {
		width: 90%;
		padding: 0 5% 0 5%;
		height: 2rem;
		font-size: 0.7193rem;
		background: white;
		align-items: center;
	}
	
	.title div {
		width: calc(100%/3);
		align-items: center;
	}
	
	.title>div:nth-child(2) {
		text-align: center;
	}
	
	.inp{
		padding-top: 2rem ;
	}
	.inp>p{
		color: #D1D5D8;
		font-size: 0.562517rem;
		padding-bottom: 0.5rem;
	}
	.inp>input{
		width: 100%;
		height: 1.5rem;
		border: none;
		border-bottom: 1px solid gray; 
		font-size: 0.65217rem;
	}
	.btns{
		width: 100%;
		height: 2.1913rem;
		background:#007AFF;
		border-radius: 0.47826rem;
		text-align: center;
		line-height: 2.3913rem;
		color: white;
		font-size: 0.7826rem;
		margin-top: 2rem;
	}

	
	
	
</style>